package com.qiyu.tech.task.futurev2;

/**
 * @Author idea
 * @Date created in 8:50 下午 2020/11/30
 */
public class TestTask implements Callable{


    public static void main(String[] args) throws InterruptedException {
        FutureTask<String> future = new FutureTask<>(new TestTask());
        future.run();
        for(int i=0;i<10;i++){
            System.out.println("====");
        }
        String result = future.get();
        System.out.println(result);
    }

    @Override
    public Object call() {
        try {
            System.out.println("do job");
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "success";
    }
}
